// TS 数据类型

// number
let num: number = 100
console.log(num)
console.log(typeof num)

// 函数参数和返回值
function sum(x: number, y: number): string{
  return x.toString() + y.toString()
}

const result = sum(1,3)
console.log(result)
console.log(typeof result)

// 数组注解
let arr: number[]
arr = [1,2,3,4]
console.log(arr)

// 元祖类型
let tuple: [number, string, boolean] = [1, 'a', true]
tuple = [10, 'bbb', false]
console.log(tuple)

// any 任意类型
let other: any = 100
other = true
other = 'aaa'
other = {a:'1', b:'2'}
console.log(other)
console.log(typeof other)

// undefined
let a
console.log(a)
console.log(typeof a)

// void 不允许返回 return
function info(): void{
  console.log('any')
}
info()

// boolean
let flag: boolean = true
flag = Boolean(0)
console.log(flag)